import http from "../utils/request"

//获取验证码
export const getCaptcha = () => http.get("/users/getCaptcha?v=next")

/**
 * 校验验证码
 * @param {String} captcha 
 * @returns {Promise} 返回一个promise对象
 */
//校验验证码
export const verifyCaptcha =captcha => http.get("/users/verifyCaptcha",{
    params:{
        captcha
    }
})

//获取手机验证码
export const getSmsCode = phoneNumber => http.post("/sms/send",{phoneNumber})

//手机验证码登入
export const smsLogin = code => http.post("/users/login?type=sms",{code})

//常规登入
/**
 * 常规登入
 * @param {String} username 用户名
 * @param {String} password 用户密码
 * @returns {Promise} 返回一个promise类型
 */
export const login = (username,password) => http.post("/users/login",{username,password})

//获取二维码
export const getQrcode = sid =>http.get("/users/getQrcode",{ params: { sid } })

//微信登录
export const wechatLogin = wechatCode =>http.get("/users/wechatLogin",{params:{wechatCode}})


